package cn.merryyou.jpa.domain;

import cn.merryyou.jpa.domain.primarykey.BookPublisherPK;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * Created on 2018/2/5.
 *
 * @author zlf
 * @since 1.0
 */
@Entity
@Setter
@Getter
@Table(name = "book_publisher")
@IdClass(value = BookPublisherPK.class)
@NoArgsConstructor
public class BookPublisher implements Serializable{
    private static final long serialVersionUID = -7228941112827868124L;

    @Id
    @ManyToOne
    @JoinColumn(name = "book_id", unique = true)
    private Book book;

    @Id
    @ManyToOne
    @JoinColumn(name = "publisher_id", unique = true)
    private Publisher publisher;

    @Column(name = "published_date")
    private Date publishedDate;

}
